package top.songxs.yygh.oss.service.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import top.songxs.yygh.common.result.R;
import top.songxs.yygh.oss.service.service.FileService;

@Api(tags = "阿里云文件管理")
@RestController
@RequestMapping("/admin/oss/file")
public class FileUploadController {

    @Autowired
    FileService fileService;

    @PostMapping("/upload")
    @ApiOperation("文件管理")
    public  R upload(@RequestParam("file") MultipartFile file){
        String url = fileService.upload(file);

        return R.ok().data("url",url);
    }
}
